
/**
 * 百度统计
 *
*/

var _hmt = _hmt || [];
(function() {
  var hm = document.createElement('script');
  hm.src = 'https://hm.baidu.com/hm.js?e5a8ae6d02545abcf1d7214ec54009db';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(hm, s);
})();

/***
 *神策数据统计
 *修改时注意： middlePage.html里也有。因该页面异步加载会有延迟，所以改成同步
*/

var curLoaction = window.location.href;
var projectType = 'default';
if (curLoaction.indexOf('fsyuncai.com') != -1 || curLoaction.indexOf('xinfangsheng.com') != -1 || curLoaction.indexOf('xfs.com') != -1) {
  projectType = curLoaction.indexOf('t.fsyuncai') == -1 && curLoaction.indexOf('t3.fsyuncai') == -1 && curLoaction.indexOf('t4.fsyuncai') == -1 && curLoaction.indexOf('pre.fsyuncai') == -1 && curLoaction.indexOf('pre.xinfangsheng') == -1 ? 'production' : 'default';
}

(function(para) {
  var p = para.sdk_url; var n = para.name; var w = window; var d = document; var s = 'script'; var x = null; var y = null;
  if (typeof (w['sensorsDataAnalytic201505']) !== 'undefined') {
    	return false;
  	}
  w['sensorsDataAnalytic201505'] = n;
  w[n] = w[n] || function(a) { return function() { (w[n]._q = w[n]._q || []).push([a, arguments]); } };
  var ifs = ['track', 'quick', 'register', 'registerPage', 'registerOnce', 'clearAllRegister', 'trackSignup', 'trackAbtest', 'setProfile', 'setOnceProfile', 'appendProfile', 'incrementProfile', 'deleteProfile', 'unsetProfile', 'identify', 'login', 'logout', 'trackLink', 'deleteItem', 'setItem'];
  for (var i = 0; i < ifs.length; i++) {
    w[n][ifs[i]] = w[n].call(null, ifs[i]);
  }
  if (!w[n]._t) {
    x = d.createElement(s), y = d.getElementsByTagName(s)[0];
    x.async = 1;
    x.src = p;
    x.setAttribute('charset', 'UTF-8');
    w[n].para = para;
    y.parentNode.insertBefore(x, y);
  }
})({
  sdk_url: './sensorsdata.min.js',
  name: 'sensors',
  server_url: window.location.protocol === 'https:' ? 'https://xinfangsheng.datasink.sensorsdata.cn/sa?token=fba64c7607e355b9&project=' + projectType : 'http://xinfangsheng.datasink.sensorsdata.cn/sa?token=fba64c7607e355b9&project=' + projectType,
  use_client_time: true,
  send_type: 'beacon',
  heatmap: {
    //是否开启点击图，default 表示开启，自动采集 $WebClick 事件，可以设置 'not_collect' 表示关闭。
    clickmap: 'default',
    //是否开启触达图，not_collect 表示关闭，不会自动采集 $WebStay 事件，可以设置 'default' 表示开启。
    scroll_notice_map: 'default',
    collect_tags: {
      div: {
				   max_level: 3 // 默认是 1，即只支持叶子 div。可配置范围是 [1, 2, 3],非该范围配置值，会被当作 1 处理。
			   },
      li: true,
      img: true,
      span: true
	   }
  },
  show_log: false
});

//公共属性

sensors.registerPage({
  platform_type: 'web',
  business_platform_type: window.location.href.indexOf('/vip') >= 0 ? '数采' : '云采'
});

sensors.quick('autoTrack');

function sensorsEvent(eventName, parameObj) {
  parameObj ? sensors.track(eventName, parameObj) : sensors.track(eventName);
}

